-
Notifications
You must be signed in to change notification settings - Fork 31
[JENKINS-63355] Prevent NPEs when library name is not provided #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/main/java/org/jenkinsci/plugins/workflow/libs/LibraryConfiguration.java
Outdated
Show resolved
Hide resolved
jglick
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what happens if a library with a null name was saved before this change? @LocalData
| for (LibraryResolver resolver : ExtensionList.lookup(LibraryResolver.class)) { | ||
| for (LibraryConfiguration config : resolver.fromConfiguration(Stapler.getCurrentRequest())) { | ||
| if (config.getName().equals(name)) { | ||
| if (name.equals(config.getName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be reverted
| for (LibraryResolver resolver : ExtensionList.lookup(LibraryResolver.class)) { | ||
| for (LibraryConfiguration cfg : resolver.forJob(run.getParent(), Collections.singletonMap(name, version))) { | ||
| if (cfg.getName().equals(name)) { | ||
| if (name.equals(cfg.getName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Actually still fails. Need to rework this. We need to skip those libraries. But probably also tell the user about it. |
|
The IAE in the constructor would interrupt the resolution in:
If only we could pass a TaskListener to the WDYT ? |
Seems enough? |
JENKINS-63355 Prevent NPEs in cases where the library name is not provided (if a library without name is accessible - in the context of a pipeline - then the
librarystep would fail with a NPE, regardless of the library it tries to find)Testing done